<h1>Editing media</h1>

<%= error_messages_for :media %>

<% form_for(@media) do |f| %>
  <p>
    <b>Artist</b><br />
    <%= collection_select(:media, :artist_id, Artist.find(:all), :id, :fullname, {:prompt => Media.l_attr('select artist')}) %>
	<%= observe_field :media_artist_id, :url => {:action => :find_artworks}, :update => :media_artwork_id, :with => :artist %>
  </p>

  <p>
    <b>Artwork</b><br />
    <%= collection_select(:media, :artwork_id, Artwork.find_all_by_artist_id(@media.artist_id), :id, :name)%>
  </p>

  <p>
    <b>File</b><br />
    <%= file_column_field "media", :file %>
  </p>

  <p>
    <b>Media type</b><br />
    <%= select(:media, :media_type, Media::OPTIONS, {:selected => @media.media_type_number}) %>
  </p>

  <p>
    <b>Caption</b><br />
    <%= f.text_field :caption %>
  </p>

  <p>
    <%= f.submit "Update" %>
  </p>
<% end %>